﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MVC.Music.Data.Models;
using MVC.Music.Data.Interfaces;
using System.Configuration;
using PetaPoco;
namespace MVC.Music.Data.Repositories
{
    public class TrackRepository : BaseRepository<TrackModel>
    {

        public TrackRepository(PetaPoco.Database database)
            : base(database)
        {
        }

        public override TrackModel Single(object primaryKey)
        {
            throw new NotImplementedException();
        }

        public override IEnumerable<TrackModel> Query()
        {
            return _database.Query<TrackModel>("select * from tbl_Track", null).AsParallel().Skip(0).Take(10);
        }

        public override List<TrackModel> Fetch()
        {
            throw new NotImplementedException();
        }

        public override Page<TrackModel> PagedQuery(long pageNumber, long itemsPerPage, string sql, params object[] args)
        {
            return _database.Page<TrackModel>(pageNumber, itemsPerPage, sql, args);
        }

        public override int Insert(object itemToAdd)
        {
            return Convert.ToInt32(_database.Insert(itemToAdd));
        }

        public override int Update(object itemToUpdate, object primaryKeyValue)
        {
            throw new NotImplementedException();
        }

        public override int Delete(object primaryKeyValue)
        {
            throw new NotImplementedException();
        }
    }
}
